package com.joker.demo.core.domain.enums;


/**
 * @author : feixiang.li
 * @since : 2025-07-23 21:37
 */

public enum JobBlockStrategyEnum {

    FAILOVER(1, "失败转移"),

    BLOCK(2, "丢弃"),

    DISCARD_LATER(3, "later丢弃"),

    COVER_EARLY(4, "early覆盖");
    private final Integer code;
    private final String desc;

    JobBlockStrategyEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static JobBlockStrategyEnum getByCode(Integer code) {
        for (JobBlockStrategyEnum value : JobBlockStrategyEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
